package com.zhl.buffered_stream2;

import java.io.*;

public class BufferedInputStreamTest1 {
    public static void main(String[] args) {
        try(
                InputStream in = new FileInputStream("D:\\Code\\LearnForJob\\java\\javasepro3\\java17\\src\\com\\zhl\\file_reader_write1\\oprate.txt");
                BufferedInputStream bin = new BufferedInputStream(in);

                OutputStream os = new FileOutputStream("D:\\Code\\LearnForJob\\java\\javasepro3\\java17\\src\\com\\zhl\\file_reader_write1\\oprate2_copy.txt");
                BufferedOutputStream bos = new BufferedOutputStream(os);

                ){
            byte[] buf = new byte[1024];
            int len;
            while ((len = bin.read(buf)) != -1) {
                bos.write(buf, 0, len);
            }
            System.out.println("文件拷贝成功！");


        }catch (Exception e){
            e.printStackTrace();
        }




    }
}
